import {createRouter, createWebHashHistory} from 'vue-router'
// import {useAuthStore} from '@/stores/authStore'
import routes from './routes'

// 因为Electron会使用Hash模式，所以这边也要使用
const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: routes
})

// 前置路由
router.beforeEach((to, from, next) => {
    // const {isLogin} = useAuthStore()
    const noAuthPages = ['login']
    if (noAuthPages.indexOf(to.name as string) > -1) next()
    // 判断是否登录
    //if (isLogin) {
    next()
    //} else {
    //  console.log('未进行登录')
    //}
})

export default router
